////
////  YRShare.swift
////  Browser
////
////  Created by 薛永伟 on 2019/4/1.
////  Copyright © 2019年 114la.com. All rights reserved.
////
//
//import Foundation
//import UIKit
//
///// 分享模块
//class YRShare {
//
//    /// 功能
//    class Feature{}
//    
//    /// UI
//    class UI {}
//
//    struct Key {
//
//        static let UMKey = "5d42b39d3fc195e1de000cd2"
//        static let channel = "AppStore"
//
//        static let wechatAppId = "wxcd3c94b1cd187f83"
//        static let wechatAppSecret = "a7a5fd330106c9f86b1071c89a8bcebb"
//
//        static let qqAppId = "101771126"
//        static let qqappSecret = "914f6ada13476a8e8c3496b29825e839"
//
//    }
//
//    struct ShareInfo {
//        var title:String
//        var subtitle:String?
//        var thumImage:UIImage?
//        /// 如果存在这个picture，则为图片分享，可能只取图片不再取webUrl等内容。
//        var picture:UIImage?
//        var pictureUrl:String?
//        var webUrl:String?
//    }
//
//    ///获得从sso或者web端回调到本app的回调
//    static func handleOpenUrl(_ url: URL,
//                              sourceApplication: String?,
//                              annotation: Any) -> Bool{
//
////        let umhandle = UMSocialManager.default()?.handleOpen(url, sourceApplication: sourceApplication, annotation: annotation)
////        return umhandle ?? false
//
//        return false
//    }
//
//}
//
//
////MARK: - --------------YRShare.Feature--------------
//
//
//extension YRShare.Feature {
//
//    /// 初始化友盟
//    class func setupUmeng(){
//
////        UMConfigure.initWithAppkey(YRShare.Key.UMKey, channel: YRShare.Key.channel)
////        confitUShareSettings()
////        configUSharePlatforms()
//    }
//
//    /// 配置友盟分享平台
//    fileprivate class func configUSharePlatforms(){
//
////        UMSocialManager.default()?.setPlaform(.wechatSession, appKey: YRShare.Key.wechatAppId, appSecret: YRShare.Key.wechatAppSecret, redirectURL: "http://mobile.umeng.com/social")
////        UMSocialManager.default()?.setPlaform(.QQ, appKey: YRShare.Key.qqAppId, appSecret: YRShare.Key.qqappSecret, redirectURL: "http://mobile.umeng.com/social")
//    }
//
//    /// 配置友盟分享设置
//    fileprivate class func confitUShareSettings(){
////
////        UMSocialGlobal.shareInstance()?.isUsingWaterMark = false
////        UMSocialGlobal.shareInstance()?.isUsingHttpsWhenShareContent = false
//    }
//
//    /// 分享内容到平台
////    class func shareToPlatformType(platform:UMSocialPlatformType,
////                                       message:UMSocialMessageObject,
////                                       currentViewController:UIViewController,
////                                       completion:@escaping UMSocialRequestCompletionHandler){
////
////        UMSocialManager.default()?.share(to: platform, messageObject: message, currentViewController: currentViewController, completion: completion)
////    }
//
//    /// 分享目标平台
//    enum ItemTarget: Int {
//
//        case weixin
//        case weixinDynamic
//
//        case weibo
//
//        case qqFriend
//        case qqZone
//
//        case moreShare //更多分享功能
//        case copylink //拷贝链接
//        case saveImage //保存图片
//
//        /// 是否可用
//        var isAvailable: Bool {
//
//            switch self {
//            case .weixin,.weixinDynamic:
//                return UMSocialManager.default()?.isInstall(.wechatSession) ?? false
//            case .weibo:
//                return UMSocialManager.default()?.isInstall(.sina) ?? false
//            case .qqFriend,.qqZone:
//                return UMSocialManager.default()?.isInstall(.QQ) ?? false
//            default:
//                return true
//            }
//        }
//
//        /// 显示信息，标题和图标
//        var showInfo:(title:String,icon:UIImage){
//
//            var title: String
//            var image: UIImage
//
//            switch self {
//            case .weixin:
//                title = NSLocalizedString("微信", comment: "")
//                image = UIImage(named: "img_share_icon_wechat")!
//            case .weixinDynamic:
//                title = NSLocalizedString("朋友圈", comment: "")
//                image = UIImage(named: "img_share_icon_timeline")!
//            case .weibo:
//                title = NSLocalizedString("微博", comment: "")
//                image = UIImage(named: "img_share_icon_weibo")!
//            case .qqFriend:
//                title = NSLocalizedString("QQ", comment: "")
//                image = UIImage(named: "img_share_icon_qq")!
//            case .qqZone:
//                title = NSLocalizedString("QQ空间", comment: "")
//                image = UIImage(named: "img_share_icon_qzone")!
//            case .moreShare:
//                title = NSLocalizedString("更多", comment: "")
//                image = UIImage(named: "img_share_icon_more")!
//            case .copylink:
//                title = NSLocalizedString("拷贝链接", comment: "")
//                image = UIImage(named: "share_复制链接")!
//            case .saveImage:
//                title = NSLocalizedString("保存图片", comment: "")
//                image = UIImage(named: "share_保存图片")!
//            }
//            return (title,image)
//        }
//
//        /// 可用的分享目标平台
//        static var availableTargets:[ItemTarget]{
//
//            var targets:[YRShare.Feature.ItemTarget] = [YRShare.Feature.ItemTarget]()
//
//            if YRShare.Feature.ItemTarget.weixin.isAvailable {
//
//                targets.append(.weixin)
//                targets.append(YRShare.Feature.ItemTarget.weixinDynamic)
//            }
//
//            if YRShare.Feature.ItemTarget.qqFriend.isAvailable {
//
//                targets.append(YRShare.Feature.ItemTarget.qqFriend)
//                targets.append(YRShare.Feature.ItemTarget.qqZone)
//            }
//
//            if YRShare.Feature.ItemTarget.weibo.isAvailable {
//
//                targets.append(YRShare.Feature.ItemTarget.weibo)
//            }
//
//            targets.append(YRShare.Feature.ItemTarget.moreShare)
//
//            return targets
//        }
//
//    }
//}
//
//
////MARK: - --------------YRShare.UI--------------
//
//extension YRShare.UI {
//
//    /// 友盟默认分享面板
//    class UMeng{
//
//        func showShareMenuViewInWindow(withPlatforms platforms:[UMSocialPlatformType],
//                                       selectionBlock block:@escaping UMSocialSharePlatformSelectionBlock){
//
//            UMSocialUIManager.setPreDefinePlatforms(platforms)
//            UMSocialUIManager.showShareMenuViewInWindow(platformSelectionBlock: block)
//        }
//    }
//
//    static var appRootController:UIViewController {
//        return (UIApplication.shared.delegate as! AppDelegate).window!.rootViewController!
//    }
//
//}
//
//
//
//
